// src/router/index.js
import Vue from 'vue';
import Router from 'vue-router'; 

// 使用 Vue Router
Vue.use(Router);

// 定义路由
const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import( '@/views/login.vue'),
  }, 
  {
    path: '/layout',
    name: 'index',
    component: () => import( '@/views/layout/index.vue'),
    redirect: '/netConfig',
    children: [
      {
        path: '/netConfig',//网络配置
        name: 'netConfig',
        component: () => import( '@/views/netConfig/index.vue'),
      },
      {
        path: '/platformInform',//平台信息
        name: 'platformInform',
        component: () => import( '@/views/platformInform/index.vue'),
      },
      {
        path: '/gatewayStatus',//网关状态
        name: 'gatewayStatus',
        component: () => import( '@/views/gatewayStatus/index.vue'),
      },
      {
        path: '/uploadConfig',//上传配置
        name: 'uploadConfig',
        component: () => import( '@/views/uploadConfig/index.vue'),
      },
    ]
  }, 
];

// 创建路由实例
const router = new Router({
  mode: 'history', // 使用 HTML5 History 模式
  routes, // 短语法，相当于 routes: routes
});

// 导出路由实例
export default router;
